
<!DOCTYPE html>
<html> 
<head> 
<title>GeoGebra and JavaScript</title> 
<script src="navigation.js"></script>
<script src="https://cdn.geogebra.org/apps/deployggb.js"></script>

</head> 
 
<body> 
 
<div> 
 
      <td> 
      <h2>GeoGebra Applet to Applet Communication</h2> 
 
      <p>This page shows how to use JavaScript listener functions to implement
applet to applet communication with GeoGebra. See <a href="https://www.geogebra.org/manual/en/Reference:JavaScript">GeoGebra JavaScript API</a> for a syntax description of the used methods.
      </p> 
<p>Change the sliders and drag the point in upper applets.</p> 


<div id="ggbApplet"></div>

<div id="ggbApplet2"></div>

 
<script type="text/javascript"> 
 
function ggbOnInit(param) {
	if (param == "ggbApplet") {
		// init update listeners for ggbApplet1
		ggbApplet.registerObjectUpdateListener("a", "abcListener");
		ggbApplet.registerObjectUpdateListener("b", "abcListener");
		ggbApplet.registerObjectUpdateListener("c", "abcListener");
		ggbApplet.registerObjectUpdateListener("A", "pointListener");
	}
}
 
function abcListener(objName) {
      // get value from applet1 and set value in applet2	
	var changedValue = ggbApplet.getValue(objName);            
	ggbApplet2.setValue(objName, changedValue);		
}
 
function pointListener(objName) {		
	// get x-coord from the changed point A in applet1
	// and set point B in applet2
	xcoord = ggbApplet.getXcoord("A");   
	ggbApplet2.setCoords("B", xcoord, 0);			
}

var parameters = {
"id": "ggbApplet",
"width":600,
"height":250,
"showMenuBar":false,
"showAlgebraInput":false,
"showToolBar":false,
"showToolBarHelp":false,
"showResetIcon":false,
"enableLabelDrags":false,
"enableShiftDragZoom":true,
"enableRightClick":false,
"errorDialogsActive":false,
"useBrowserForJS":true,
"preventFocus":false,
"language":"en",
// use this instead of ggbBase64 to load a material from GeoGebra Materials Platform
// "material_id":12345,
"ggbBase64":"UEsDBBQACAAIAJuknT4AAAAAAAAAAAAAAAAMAAAAZ2VvZ2VicmEueG1s3VnbbuM2EH3ufgWhh3a3RRxSF0tE7SxyeQmQNkWTLto+FKAl2majiytRjp2v75CUZMu32M4uNhu/SCJHJOecOcOh3Ps4S2I05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oFv98lb82k5540Cbcxu7S6x7ZIl2vCfteAfu7fUtYxdmScLSCKUsge4riPEpEDLl2lehyknEsPLdLLmUTcv3bJIVP5vxqlH2wPCHI0GsYm03isvK0Yh+FRB/U6Xds/id70ZO14eNv+fWUVFFbFMT6mtVEx6NyfFaraqaQqUSXXHN9du+t7yrOZAbnsxJSr9iCmR1GFgcJLZjfg+1Fl9D/Ry8JZvAj3aDr+hvsI22R+xqOjs2YiGtrmX7A9lZIAwbkdtClqgj3rw6pD7psVv92CY7on7VR/5famwKU2hDno1FKOQRmlhkkBY5F4co42JdGXsB/zqlgbuu5zuUEuwQh7qVUlzXcbq+26V24HjEd72XKOU2h6PCKEtZfKOivE3JhRHM7ByOXWu88ANEwz+LaA6rj45XDKnKG9woZI2J4wUikn0EspOW8120jA+gZfyt0/LFediUqMZrmF8dkqKunktRm/F8nRlKEwJbTIADn1LX9lViIoS8JCX9zuabA/5qDXixG/gcRqpRFXvEOtkU7PtUVl9g38YdGjjLmLqt4FfbOiUBpT5xwM7Bnr+PGMgeatAIx4r361TyvOC6Zq++ZS0B8MD5RH1+vE3vc5YW6pN2+zvYYbLia+xeHiKry7ckq00bP+lADHgexbD9u4EdvKhAXtdYtddfrrEw3F9jw2M19hWL465PCCWe7wLmftf1VrYYB1iwKXUCirEPqL9qkZ0ufw7Wf6pU/zed/Q9QSwcIm4g1GJ8FAAChGgAAUEsBAhQAFAAIAAgAm6SdPpuINRifBQAAoRoAAAwAAAAAAAAAAAAAAAAAAAAAAGdlb2dlYnJhLnhtbFBLBQYAAAAAAQABADoAAADZBQAAAAA="};


var parameters2 = {
"id": "ggbApplet2",
"width":600,
"height":250,
"showMenuBar":false,
"showAlgebraInput":false,
"showToolBar":false,
"showToolBarHelp":false,
"showResetIcon":false,
"enableLabelDrags":false,
"enableShiftDragZoom":true,
"enableRightClick":false,
"errorDialogsActive":false,
"useBrowserForJS":true,
"preventFocus":false,
"language":"en",
// use this instead of ggbBase64 to load a material from GeoGebra Materials Platform
//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bHCcW+JXjgQbYFwOvZoF0eogF9iWpyQ7a75+SpN4/D+6/UI6CdchODM62ivoB96X8I3LUT3q1PyLe79gnfdg+JXBqwU//POmJ9qNQQP6RPPAD6TMmt6ID0lPkiyhgikpJw4gdEhvs6cFhkczQDT7keF40tjWp7hzT3sAp1Mzwi8KP+XWp8wr/jW77aPm0KNuf1y6eEmkXB0XafU3THxpwe8KNPRZutC8j6kM5CmUgJASX2HaI+8JLHRheu2eAy+YMcLQ8ujjukaZ3tbPjY28b893ef9sYl89Le37ovjKF7itT+DqBdR+QUoWRCAUXXEGPJdDy/4e8deny1iUepWiPsOMdtx8dnsBGr3BSeNU0tlPW98H/F0pdp90PS/YzdPP/At79D1BLBwgffOprkggAAMggAABQSwECFAAUAAgICAA6YmJI1je9uRkAAAAXAAAAFgAAAAAAAAAAAAAAAAAAAAAAZ2VvZ2VicmFfamF2YXNjcmlwdC5qc1BLAQIUABQACAgIADpiYkjP1e80lwQAAP4hAAAXAAAAAAAAAAAAAAAAAF0AAABnZW9nZWJyYV9kZWZhdWx0czJkLnhtbFBLAQIUABQACAgIADpiYkjuv2/opwIAAGgLAAAXAAAAAAAAAAAAAAAAADkFAABnZW9nZWJyYV9kZWZhdWx0czNkLnhtbFBLAQIUABQACAgIADpiYkgffOprkggAAMggAAAMAAAAAAAAAAAAAAAAACUIAABnZW9nZWJyYS54bWxQSwUGAAAAAAQABAAIAQAA8RAAAAAA"};

// is3D=is 3D applet using 3D view, AV=Algebra View, SV=Spreadsheet View, CV=CAS View, EV2=Graphics View 2, CP=Construction Protocol, PC=Probability Calculator, DA=Data Analysis, FI=Function Inspector, PV=Python, macro=Macro View
var views = {'is3D': 0,'AV': 1,'SV': 0,'CV': 0,'EV2': 0,'CP': 0,'PC': 0,'DA': 0,'FI': 0,'PV': 0,'macro': 0};

var applet = new GGBApplet(parameters, '5.0', views);
              
    //  when used with Math Apps Bundle, uncomment this:
    //  applet.setHTML5Codebase('GeoGebra/HTML5/5.0/web/');
var applet2 = new GGBApplet(parameters2, '5.0', views);
              
    //  when used with Math Apps Bundle, uncomment this:
    //  applet2.setHTML5Codebase('GeoGebra/HTML5/5.0/web/');

window.onload = function() {
	applet.inject('ggbApplet');
	applet2.inject('ggbApplet2');
};

</script> 
     </div>
</table> 
</body> 
</html> 